define(['jquery', 'bootstrap', 'backend', 'template'], function ($, undefined) {
    var Controller = {
        index: function(){
            const grid = $('.grid');
            const grid_cols = grid.attr('cols') || 4;
            grid.css('grid-template-columns','repeat('+grid_cols+', 1fr)');
            const grid_objs = grid.children();
            $(grid_objs[grid_objs.length - 1]).css('border-right','none');
            for (let i=0;i<(grid_objs.length / grid_cols).toFixed(0);i++){
                $(grid_objs[i * parseInt(grid_cols) + parseInt(grid_cols) - 1]).css('border-right','none');
            }
            grid.css('display','grid');
            const height = $(document).height();
            const iframe_height = height - $('.grid-box').height()  - 60;
            $('iframe').height(iframe_height + 'px');

            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                
            }
        }
    };
    return Controller;
});
